Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop support for USB, HID and Serial device access #198047

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

thegecko
Copy link
Contributor

This is a new feature to add USB, HID and Serial device access to the desktop by extending the existing WebUSB, WebHID and WebSerial functionality already offered in the web version #152310.

Since Electron version 25, Web-* device access has been possible using the functionality described here: https://www.electronjs.org/docs/latest/tutorial/devices

This ability is awesome because it allows access to functionality in Chrome already shipped as part of VS Code and means extension developers no longer have to include external packages such as node-usb or SerialPort. In many cases this approach should be more stable and reliable, too (e.g. chrome uses winusb for device access over libusb as used in node-usb).

To implement this addition, I've wired up a QuickPick dropdown for the user to choose the requested device leveraging Electron's APIs. Unfortunately the cleanest way I've been able to find to communicate between the electron-main and browser process is via the globals API. Happy to hear of a better way.

USB Selector:

Screenshot 2023-11-12 at 16 52 46

Serial Selector:

Screenshot 2023-11-12 at 17 00 18

HID Selector:

Screenshot 2023-11-12 at 17 01 59

Please note: As this utilises the existing features in chrome, obtaining a concrete device after authorising it is only possible in the desktop web extension host. Therefore this feature is only available to pure web extensions (those without a main entrypoint in package.json).

@bpasero bpasero self-assigned this Nov 14, 2023
@bpasero bpasero added this to the Backlog milestone Nov 14, 2023
@thegecko
Copy link
Contributor Author

thegecko commented Mar 2, 2024

Anything required to progress this PR?

@bpasero
Copy link
Member

bpasero commented Dec 18, 2024

Is there an associated issue with sufficient upvotes and motion to justify this change? And an explainer about the scenarios this would enable?

@bpasero bpasero added the info-needed Issue requires more information from poster label Dec 18, 2024
@thegecko
Copy link
Contributor Author

thegecko commented Dec 18, 2024

Is there an associated issue with sufficient upvotes and motion to justify this change? And an explainer about the scenarios this would enable?

Issue raised here: #236450

@bpasero bpasero removed the info-needed Issue requires more information from poster label Dec 18, 2024
@bpasero
Copy link
Member

bpasero commented Dec 18, 2024

There are many conflicts in this PR btw.

@thegecko
Copy link
Contributor Author

There are many conflicts in this PR btw.

TBF, there weren't conflicts when I opened it a year ago and I got tired of keeping it up to date with no feedback.

If there is interest in this feature I'll revisit the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants